from math import sqrt

class MyMath:
    @staticmethod
    def add(x, y):
        return x+y

    @staticmethod
    def sub(x, y):
        return x-y

    @staticmethod
    def mul(x, y):
        return x*y

    @staticmethod
    def div(x, y):
        return x/y

    @staticmethod
    def exa_div(x, y):
        return x//y

    @staticmethod
    def take_re(x, y):
        return x%y

    @staticmethod
    def in_power(x, y):
        return x**y

    @staticmethod
    def ex_root(x):
        return sqrt(x)

#在类中创建类属性
class Cook(object):
        cut = '切菜'
        stew = "烹调食材"

#在类中创建私有属性
class Cook1(object):
    __cut = "切菜"
    __stew = "烹调食材"
    def to_cook(self):
        pass

#在__init__中初始化实例属性
class mantoCook(Cook):
    cut = "切菜"
    def __init__(self, food):
        self.food = food

#在__init__中初始化实例私有属性
class mantoCook1(Cook):
    __cut = "切菜"
    def __init__(self, food):
        self.__food = food

#通过类方法来获取类的私有属性
class mantoCook2(Cook):
    __cut = "切菜"
    def __init__(self, food):
        self.__food = food

    @classmethod
    def get_cut(cls):
        return cls.__cut


#在类中实现__str__
class Cook2(list):
    def __cut__(self):
        self = a
        return None

    def __str__(self):
        return f"厨师为：{list(self)}"


if __name__ == "__main__":
    math = MyMath()
    print(MyMath.add(1, 2))
    print(MyMath.sub(3, 2))
    print(MyMath.mul(2, 3))
    print(MyMath.div(2, 4))
    print(MyMath.exa_div(2, 4))
    print(MyMath.take_re(2, 4))
    print(MyMath.in_power(2, 4))
    print(MyMath.ex_root(4))

print(Cook.cut)
print(Cook.stew)

print(Cook1._Cook1__cut)
print(Cook1._Cook1__stew)

jack = mantoCook(1)
print(jack.food)

jack1 = mantoCook1(2)
print(jack1._mantoCook1__food)

print(mantoCook2.get_cut())

b = Cook2(['sam', 'jack'])
print(b)